<%-- 
    Document   : detail
    Created on : Jan 28, 2014, 6:21:35 PM
    Author     : Michal Fucik
--%>

<%@ page contentType="text/html; charset=utf-8" pageEncoding="iso-8859-2" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

<s:layout-render name="/jsp/layout.jsp" titlekey="admin.courses.title">
    <s:layout-component name="header"></s:layout-component>

    <s:layout-component name="body">
        <%@include file="../menu.jsp"%>
        <s:useActionBean beanclass="cz.muni.fi.pa165.languageschool.web.CourseActionBean" var="actionBean"/>
        <sec:authentication property="authorities" var="role" scope="page"/>

        <c:choose>
            <c:when test="${role} == ROLE_ADMIN">
                <h2>
                    <f:message key="admin.courses.title"/>
                </h2>
            </c:when>
            <c:otherwise>
                <h2>
                    <f:message key="member.courses.title"/></strong>
            </h2> 
        </c:otherwise>
    </c:choose>

    <fieldset>
        <legend>
            <f:message key="course.entity.lectures"/> - <strong>${actionBean.course.code} ${actionBean.course.name}</strong>
        </legend>
        <table>
            <tr>
                <th><f:message key="lecture.entity.id"/></th>
                <th><f:message key="lecture.entity.label"/></th>
                <th><f:message key="lecture.entity.tpDay"/></th>
                <th><f:message key="lecture.entity.tpTime"/></th>
            </tr>
            <c:forEach items="${actionBean.course.relatedLectures}" var="lecture">
                <tr>
                    <td class="content"><c:out value="${lecture.id}"/></td>
                    <td class="content"><c:out value="${lecture.label}"/></td>
                    <td class="content"><c:out value="${lecture.tpDay}"/></td>
                    <td class="content"><c:out value="${lecture.tpTime}"/></td>
                </tr>
            </c:forEach>
        </table>
    </fieldset>
    <s:form beanclass="cz.muni.fi.pa165.languageschool.web.CourseActionBean">
        <s:submit id="button" name="cancelDetail">
            <f:message key="lecture.cancel.label"/>
        </s:submit>
    </s:form>
</s:layout-component>
</s:layout-render>
